<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>添加计划</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../../css/common.css" />
		<style type="text/css">
			a.mui-action-back {
				color: white;
			}
			
			.mui-content {
				padding: 20px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">新增</h1>
		</header>
		<div class="mui-content">
			<textarea name="" rows="" cols="" placeholder="请输入备忘信息" style="margin: 15px 0;" id="bwInfo"></textarea>
			<button class="mui-btn mui-btn-primary mui-btn-block" id="btnAdd">添加</button>
		</div>
		<script src="../../js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init();
			(function($, doc) {
				doc.querySelector("#btnAdd").addEventListener("click", function() { //点击提交按钮
					var info = doc.querySelector("#bwInfo").value;
					info ? insertInfo(info) : $.alert("备忘信息不能为空！");

				});
			}(mui, document));

			function insertInfo(info) {
				db.transaction(function(tx) {
					var time = getMyDate(new Date());
					console.log(time);
					var creatSql = 'CREATE TABLE IF NOT EXISTS t_notic (content ,creattime ,updatatime ,state)';
					var insertSql = 'INSERT INTO t_notic (content,creattime,updatatime,state) VALUES (?,?,?,"1")';
					tx.executeSql(creatSql);
					tx.executeSql(insertSql,[info,time,time]);
					mui.alert("新增成功！",function () {
						mui.back();
					})
				});
			}
		</script>
	</body>

</html>